| Conditions | 1 |
| Total Lines | 35 |
| Code Lines | 32 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | import React, { useRef } from 'react'; |
||
| 19 | .then(() => { |
||
| 20 | // Reset input after processing file |
||
| 21 | 1 | target.value = null; |
|
| 22 | }); |
||
| 23 | |||
| 24 | 3 | return ( |
|
| 25 | <React.Fragment> |
||
| 26 | <button |
||
| 27 | type="button" |
||
| 28 | className="btn btn-outline-secondary mr-2" |
||
| 29 | id="importBtn" |
||
| 30 | 1 | onClick={() => ref.current.click()} |
|
| 31 | > |
||
| 32 | Import from file |
||
| 33 | </button> |
||
| 34 | <UncontrolledTooltip placement="top" target="importBtn"> |
||
| 35 | You can create servers by importing a CSV file with columns <b>name</b>, <b>apiKey</b> and <b>url</b>. |
||
| 36 | </UncontrolledTooltip> |
||
| 37 | |||
| 38 | <input type="file" accept="text/csv" className="create-server__csv-select" ref={ref} onChange={onChange} /> |
||
| 39 | </React.Fragment> |
||
| 40 | ); |
||
| 41 | }; |
||
| 42 | |||
| 43 | 3 | ImportServersBtnComp.propTypes = propTypes; |
|
| 44 | |||
| 45 | 3 | return ImportServersBtnComp; |
|
| 46 | }; |
||
| 47 | |||
| 48 | export default ImportServersBtn; |
||
| 49 |